#include <iostream>
#include <string>
using namespace std;


int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		float t;
		int x;
		string s;
		cin>>t>>x>>s;
		if(7 <= t  &&  t <= 8  &&  1500 <= x  &&  s == "Yes")
			cout<<"Yes"<<endl;
		else
			cout<<"No"<<endl;
	}
	return 0;
}
